package com.redpacketcover.rc.base;

import com.redpacketcover.rc.util.UserInfo;

import java.io.IOException;

import okhttp3.Interceptor;
import okhttp3.Request;
import okhttp3.Response;

public class AddHeaderInterceptor implements Interceptor {
    @Override
    public Response intercept(Chain chain) throws IOException {
        Request request = chain.request();
        request = request.newBuilder()
                .addHeader("Authorization", UserInfo.Companion.getInstance().getLoginToken())
                .addHeader("Coordinate", UserInfo.Companion.getInstance().getLocation())
                .method(request.method(), request.body())
                .build();
        return chain.proceed(request);
    }

}
